package com.acme.task2;

public class GCTest {

    public static void main(String[] args) {
        //modify numberOfIterations to check that GC is called
        int numberOfIterations = 50000000;
        Foo [] arrayFoo = new Foo[numberOfIterations];

        for (int i = 0; i < numberOfIterations; i++) {
            //collect references to foo at an array
            //to prevent object being garbage collected
            Foo foo = new Foo(i);
            arrayFoo[i] = foo;
        }
    }
}
